#include <iostream>
#include <cmath>
#include <fstream>
#include <string>

std::ifstream fin("bfdiff.in");
int const maxn = 10000;
int const avg = 12;
int da[maxn];
int n, sum;

int main()
{
	fin >> n;
	fin >> n;
	sum = 0;
	for (int i = 1; i <= n; i++) {
		fin >> da[i];
		sum += da[i];
	}
	std::string s;
	std::cin >> s;

	if (s == "NO") {
		std::cout << "NO\n";
		if (sum % n) std::cout << "fuck\n";
	} else {
		std::cout << "YES\n";
		int m;
		std::cin >> m;
		std::cout << m << '\n';
		for (int i = 0, x, y; i < m; i++) {
			std::cin >> x >> y;
			std::cout << x << ' ' << y << '\n';
			da[x]--;
			da[y]++;
			if (!(std::abs(x-y) == 1 || std::abs(x-y) == n-1)) std::cout << "fuck";
		}
		for (int i = 2; i <= n; i++)
			if (da[i] != da[i-1]) std::cout << "fuckkkk";
	}
}
